package com.example.administrator.easy.detailxinfo;

import android.graphics.Color;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;

import com.example.administrator.easy.R;
import com.example.administrator.easy.adapter.FragmentVideoAdapter;

import java.util.ArrayList;
import java.util.List;

public class DetailvideoLive extends AppCompatActivity {
    private List<Fragment> mFragmentList;
    private FragmentVideoAdapter mAdapter;
    private ViewPager viewPager;
    private TabLayout tabLayout;
    String title[]={"LIVE","CHAT"};

    private String id;
    private String id2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_detailvideo_live);

        initView();
        initFragment();

    }

    private void initView() {
        viewPager= (ViewPager) findViewById(R.id.vp_detail_video);
        tabLayout= (TabLayout) findViewById(R.id.tablayout_videos);
        tabLayout.setupWithViewPager(viewPager);
        tabLayout.setTabTextColors(Color.BLACK,Color.RED);
        tabLayout.setBackgroundResource(R.mipmap.default_circle_img);
    }

    private void initFragment() {
        mFragmentList=new ArrayList<>();
        Fragment f1=new FragmentVideo();
        Fragment f2=new FragmentVideo();
        Bundle bundle=new Bundle();
        bundle.putString("id","http://m.ieasy.tv/api/livechat/list/10/46543/0");
        bundle.putInt("temp",1);

        Bundle bundle1=new Bundle();
        bundle1.putString("id","http://m.ieasy.tv/api/livechat/unreadlive/46543/422834");
        bundle1.putInt("temp",0);
        f1.setArguments(bundle1);
        f2.setArguments(bundle);
        mFragmentList.add(f1);
        mFragmentList.add(f2);
        mAdapter=new FragmentVideoAdapter(getSupportFragmentManager(),mFragmentList,title);
        viewPager.setAdapter(mAdapter);


    }
}
